Problem: Let $\overline{AB}$ be a diameter of circle $\omega$. Extend $\overline{AB}$ through $A$ to $C$. Point $T$ lies on $\omega$ so that line $CT$ is tangent to $\omega$. Point $P$ is the foot of the perpendicular from $A$ to line $CT$. Suppose $\overline{AB} = 18$, and let $m$ denote the maximum possible length of segment $BP$. Find $m^{2}$.

Explanation: [asy] size(250); defaultpen(0.70 + fontsize(10)); import olympiad; pair O = (0,0), B = O - (9,0), A= O + (9,0), C=A+(18,0), T = 9 * expi(-1.2309594), P = foot(A,C,T); draw(Circle(O,9)); draw(B--C--T--O); draw(A--P); dot(A); dot(B); dot(C); dot(O); dot(T); dot(P); draw(rightanglemark(O,T,C,30)); draw(rightanglemark(A,P,C,30)); draw(anglemark(B,A,P,35)); draw(B--P, blue); label("\(A\)",A,NW); label("\(B\)",B,NW); label("\(C\)",C,NW); label("\(O\)",O,NW); label("\(P\)",P,SE); label("\(T\)",T,SE); label("\(9\)",(O+A)/2,N); label("\(9\)",(O+B)/2,N); label("\(x-9\)",(C+A)/2,N); [/asy]
Let $x = OC$. Since $OT, AP \perp TC$, it follows easily that $\triangle APC \sim \triangle OTC$. Thus $\frac{AP}{OT} = \frac{CA}{CO} \Longrightarrow AP = \frac{9(x-9)}{x}$. By the Law of Cosines on $\triangle BAP$,\begin{align*}BP^2 = AB^2 + AP^2 - 2 \cdot AB \cdot AP \cdot \cos \angle BAP \end{align*}where $\cos \angle BAP = \cos (180 - \angle TOA) = - \frac{OT}{OC} = - \frac{9}{x}$, so:\begin{align*}BP^2 &= 18^2 + \frac{9^2(x-9)^2}{x^2} + 2(18) \cdot \frac{9(x-9)}{x} \cdot \frac 9x = 405 + 729\left(\frac{2x - 27}{x^2}\right)\end{align*}Let $k = \frac{2x-27}{x^2} \Longrightarrow kx^2 - 2x + 27 = 0$; this is a quadratic, and its discriminant must be nonnegative: $(-2)^2 - 4(k)(27) \ge 0 \Longleftrightarrow k \le \frac{1}{27}$. Thus,\[BP^2 \le 405 + 729 \cdot \frac{1}{27} = \boxed{432}\]Equality holds when $x = 27$.